import { defHttp } from '@/utils/http/axios';
import { RequestEnum } from '@/enums/httpEnum';
import { ServicePrefixEnum } from '@/enums/commonEnum';
import type { AxiosRequestConfig } from 'axios';

const MODULAR = '/system/tenant-package';

export const Api = {
  GetTenantPackagePage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/page`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
  GetTenantPackage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/get`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
  CreateTenantPackage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/create`,
    method: RequestEnum.POST,
  } as AxiosRequestConfig,
  UpdateTenantPackage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/update`,
    method: RequestEnum.PUT,
  } as AxiosRequestConfig,
  DeleteTenantPackage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/delete`,
    method: RequestEnum.DELETE,
  } as AxiosRequestConfig,
  GetTenantPackageList: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/simple-list`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
}


// 查询租户套餐列表
export const getTenantPackagePage = (params) => {
  return defHttp.request({ ...Api.GetTenantPackagePage,params})
}

// 获得租户
export const getTenantPackage = (id: number) => {
  let params = {id}
  return defHttp.request({ ...Api.GetTenantPackage,params})
}

// 新增租户套餐
export const createTenantPackage = (data: TenantPackageVO) => {
  return defHttp.request({ ...Api.CreateTenantPackage,params:data})
}

// 修改租户套餐
export const updateTenantPackage = (data: TenantPackageVO) => {
  return defHttp.request({ ...Api.UpdateTenantPackage,params:data})
}

// 删除租户套餐
export const deleteTenantPackage = (id: number) => {
  let params = {id}
  return defHttp.request({ ...Api.DeleteTenantPackage,params:params})
}

// 获取租户套餐精简信息列表
export const getTenantPackageList = () => {
  return defHttp.request({ ...Api.GetTenantPackageList})
}

export interface TenantPackageVO {
  id: number
  name: string
  status: number
  remark: string
  creator: string
  updater: string
  updateTime: string
  menuIds: number[]
  createTime: Date
}

// 查询租户套餐列表
// export const getTenantPackagePage = (params: PageParam) => {
//   return request.get({ url: '/system/tenant-package/page', params })
// }
//
// // 获得租户
// export const getTenantPackage = (id: number) => {
//   return request.get({ url: '/system/tenant-package/get?id=' + id })
// }
//
// // 新增租户套餐
// export const createTenantPackage = (data: TenantPackageVO) => {
//   return request.post({ url: '/system/tenant-package/create', data })
// }
//
// // 修改租户套餐
// export const updateTenantPackage = (data: TenantPackageVO) => {
//   return request.put({ url: '/system/tenant-package/update', data })
// }
//
// // 删除租户套餐
// export const deleteTenantPackage = (id: number) => {
//   return request.delete({ url: '/system/tenant-package/delete?id=' + id })
// }
// // 获取租户套餐精简信息列表
// export const getTenantPackageList = () => {
//   return request.get({ url: '/system/tenant-package/simple-list' })
// }
